<?php
// UdA seulement - récupération des périodes déjà définies
$tbl_mdb_names = claro_sql_get_main_tbl();
$tbl_UDADOCdocumentVisibilityPeriod = claro_sql_get_tbl('UDADOCdocumentVisibilityPeriod');
$tbl_UDADOCdocumentVisibilityPeriod = $tbl_UDADOCdocumentVisibilityPeriod['UDADOCdocumentVisibilityPeriod'];

$tbl_CLFDdocumentVisibilityPeriod = claro_sql_get_tbl('CLFDdocumentVisibilityPeriod');
$tbl_CLFDdocumentVisibilityPeriod = $tbl_CLFDdocumentVisibilityPeriod['CLFDdocumentVisibilityPeriod'];

$sql = "SELECT * FROM `".$tbl_CLFDdocumentVisibilityPeriod."`";
$visibilityDates = claro_sql_query_fetch_all($sql);

if ($visibilityDates)
{
	foreach ($visibilityDates as $date)
	{
		$sql = "INSERT INTO `".$tbl_UDADOCdocumentVisibilityPeriod."`
				SET course_code = '".$date['course_code']."',
					documentId = ".$date['document_id'].",
					visibilityStartDate = '".$date['visibilityStartDate']."',
					visibilityEndDate = '".$date['visibilityEndDate']."',
					allUsers = 1
		";
		claro_sql_query($sql);
	}
}

?>